<?php
namespace app\service;
use app\model\AdImgModel;
use app\model\AdvertisementModel;
use think\Model;
use think\facade\Db;
class IndexService extends Model
{
    //如果表名和文件名不是对应的，用下面代码修改
    protected $name = 'system';
    public function getsystem(){
        return $this->column('value','enname');
    }
    public function ad(){
        $data=AdvertisementModel::column('id','key');
        foreach($data as $k=>$v){
            $data[$k]=AdImgModel::field('title,url,img')->where('isopen',1)->where('ad_id',$v)->select()->toArray();
        }
        return $data;
    }
}